# filename='D:\pydataset\CCIRCup\CCIRCup.test.bmes'
# outfile='D:\pydataset\CCIRCup\CCIRCup.test.Sentence'

# filename='D:\ProgramFiles\pythonworkplace\LGN\data\CCIRCupdecode.txt'
# outfile='D:\ProgramFiles\pythonworkplace\LGN\data\CCIRCupdecode.Sentence'

filename='D:\pydataset\PeopleDaily\example.test.bmes'
outfile='D:\pydataset\PeopleDaily\PeopleDaily.test.Sentence'

with open(outfile,mode='w',encoding='utf8') as BmesSentence:
    i=4
    Sentence=''
    sentenceNum=1
    for line in open(filename, encoding='utf-8'):
        line=line.strip('\n')
        # print(line)
        a=line.split(' ')
        if len(line) != 0:
            if a[0] in list('０１２３４５６７８９0123456789'):
                Sentence += '0'
            else:
                Sentence += a[0]
        else:
            BmesSentence.write(str(sentenceNum)+','+Sentence+'\n')
            Sentence=''
            sentenceNum+=1



